#pragma once

#include "winos.h"

_SSL_BEGIN
_SSWINOSL_BEGIN

_SSBASEL_USE_NP

class window_message_filter
{
public:
	virtual LRESULT window_proc(UINT msg, WPARAM wparam, LPARAM lparam, bool &handled) = 0;
};

#pragma warning(push)
#pragma warning(disable:4251)
class SSWINOS_CLASS win_window
{
public:
	win_window(
		HINSTANCE inst = NULL,
		window_message_filter *msg_filter = NULL,
		const tstring &class_name =_T("")
		);
	virtual ~win_window();

public:
	bool create();
	bool is_valid() const;
	bool destory();

	void msg_loop();

	HWND get_window() const;
public:
	virtual LRESULT window_proc(UINT msg, WPARAM wparam, LPARAM lparam, bool &handled);

protected:
	bool register_class_if_necessary();

protected:
	static LRESULT CALLBACK ___window_proc___(HWND window_h, UINT msg, WPARAM wparam, LPARAM lparam);

protected:
	HINSTANCE inst_;
	tstring class_name_;
	HWND window_;
	bool in_my_msg_loop_;
	window_message_filter *message_filter_;
};
#pragma warning(pop)

_SSWINOSL_END
_SSL_END

